//
//  LRNetwork.h
//  LRShop
//
//  Created by HCW on 16/7/28.
//  Copyright © 2016年 HCW. All rights reserved.
//

#define DDLog(xx, ...)  NSLog(@"%s(%d): " xx, __PRETTY_FUNCTION__, __LINE__, ##__VA_ARGS__)

#import <Foundation/Foundation.h>
#import "AFNetworking.h"

typedef void (^ReturnValueBlock)(id returnValue);
typedef void (^ErrorCodeBlock)(NSInteger errorCode, NSString *errorMessage);
typedef void (^FailureBlock)();
typedef void (^UploadProgressBlock)(NSUInteger bytesWritten, long long totalBytesWritten, long long totalBytesExpectedToWrite);

typedef void (^NetWorkBlock)(BOOL isNetWork);

@interface LRNetwork : NSObject

#pragma 监测网络的可链接性
+ (void)netWorkReachabilityWithURLString:(NSString *)strUrl resultBlock:(NetWorkBlock)netWorkBlock;

#pragma GET
+ (void) netRequestGETWithRequestURL: (NSString *) requestURLString
                        withParameter: (NSDictionary *) parameter
                 withReturnValeuBlock: (ReturnValueBlock) block
                   withErrorCodeBlock: (ErrorCodeBlock) errorBlock
                     withFailureBlock: (FailureBlock) failureBlock;

#pragma POST
+ (void) netRequestPOSTWithRequestURL: (NSString *) requestURLString
                        withParameter: (NSDictionary *) parameter
                 withReturnValeuBlock: (ReturnValueBlock) block
                   withErrorCodeBlock: (ErrorCodeBlock) errorBlock
                     withFailureBlock: (FailureBlock) failureBlock;

#pragma POST IMAGES
+ (void) netRequestPOSTImagesWithRequestURL: (NSString *) requestURLString
                              withParameter: (NSDictionary *) parameter
                               withFileData: (NSArray *) images
                       withReturnValeuBlock: (ReturnValueBlock) block
                         withErrorCodeBlock: (ErrorCodeBlock) errorBlock
                           withFailureBlock: (FailureBlock) failureBlock
                    withUploadProgressBlock: (UploadProgressBlock) uploadProgressBlock;

@end
